
#pragma once
#include <string>
#include <optional>

#include "server/rtmp/amf0/amf0_inc.hpp"
#include "server/rtmp/rtmp_protocol/rtmp_define.hpp"

namespace mms
{
    class RtmpMessage;
    class RtmpPlayMessage
    {
    public:
        RtmpPlayMessage();
        RtmpPlayMessage(int32_t transaction_id);
        RtmpPlayMessage(int32_t transaction_id, const std::string &stream_name);
        virtual ~RtmpPlayMessage();

    public:
        int32_t decode(std::shared_ptr<RtmpMessage> rtmp_msg);
        std::shared_ptr<RtmpMessage> encode();
        int32_t size() const;
        const std::string &stream_name() const;

    public:
        Amf0String command_name_;
        Amf0Number transaction_id_;
        Amf0Null null_;
        Amf0String stream_name_;
        std::optional<Amf0Number> start_;
        std::optional<Amf0Number> duration_;
        std::optional<Amf0Boolean> reset_;

        int32_t start_pts_ = 0;
        int32_t duration_ms_ = 0;
        bool reset_play_ = false;
    };

};